<?php

	$title = fill( getTerm('albums', 'search_title') , $keywords );
	pushNavigationItem( getTerm('albums', 'albums') , formatUrl('/albums/') );
	pushNavigationItem( $title , formatUrl("/albums/$userParam/") );
	printHeader($title, $title, 'albums');
	
?>

	<div class="topResultForm searchForm">
	
		<p>
		
			<h3><?= getTerm('albums', 'search_photos') ?></h3>
			
			<form action="<?= formatUrl('/albums/search.do') ?>" method="get">
			
				<input type="text" name="w" id="keywords" value="<?= $keywords ?>" />
				
				<input type="hidden" name="p" value="1" />
				
				<input type="submit" value="<?= getTerm('albums', 'search') ?>" />
			
			</form>
		
		</p>
		
	</div>
	
	<?php if ( empty($results) ) { ?>
		
	<p>
		<?= getTerm('albums', 'no_result') ?>
	</p>
		
	<?php } else { ?>
	
	<div class="photoSearchResults searchResults">
	
		<ul>

		<?php foreach ( $results as $result ) { ?>
	
			<li>
			
				<div class="imageOverview">
					<a href="<?= formatUrl("/albums/${result[username]}/${result[albumPath]}/${result[path]}.html") ?>" />
						<img src="/Thumbs/<?= $result['id'] ?>-square.jpg" alt="<?= $result['name'] ?>" title="<?= $result['name'] ?>" />
					</a>
				</div>
				
				<div class="imageInformations">
					<div class="imageName">
						<a href="<?= formatUrl("/albums/${result[username]}/${result[albumPath]}/${result[path]}.html") ?>"><?= $result['name'] ?></a>
					</div>
					
					<div class="imageInfos">
					
						<?=
							fill
							(
								getTerm('albums', 'photo_album_user_infos') ,
								'<a href="'. formatUrl("/albums/${result[username]}/${result[albumPath]}/") .'">'. $result['albumName'] .'</a>' ,
								'<a href="'. formatUrl("/profile/${result[username]}") .'">'. $result['username'] .'</a>'
							) 
						?>
						
					</div>
					
					<div class="imageSecondaryInfos">
						<?= fill( getTerm('albums', 'shared_since') , formatDate( $result['creationdate'] ) ) ?>
					</div>
				</div>
				
			</li>
	
		<?php } ?>

		</ul>

	</div>

	<div class="bottomResultForm searchForm">
	
		<p>
		
			<h3><?= getTerm('albums', 'search_photos') ?></h3>
			
			<form action="<?= formatUrl('/albums/search.do') ?>" method="get">
			
				<input type="text" name="w" id="keywords" value="<?= $keywords ?>" />
				
				<input type="hidden" name="p" value="1" />
				
				<input type="submit" value="<?= getTerm('albums', 'search') ?>" />
			
			</form>
		
		</p>
		
	</div>
	
	<?php } ?>


<?php

	printFooter();

?>